import java.util.LinkedList;
import java.util.Queue;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 石方旭
 * Date: 2022-05-17
 * Time: 12:40
 */
class Solution {
    public int timeRequiredToBuy(int[] tickets, int k) {
        Queue<Integer> queue = new LinkedList<>();
        //每一个人都要去指定位置买票，如果票数为0就弹出在也不买了，
        //一直到k下标人的票数为0就结束买票
        int len = tickets.length;
        for(int i =0;i<len;++i){
            while(tickets[k]!=0){
                queue.offer(tickets[i]);//入队列

                queue.poll();

            }

        }
    }
}
public class TestDemo {

    public static void main(String[] args) {

    }


}
